package com.example.mskefu.mapper;

import com.example.mskefu.entity.dto.BrowseRecordAndShop;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.ArrayList;

@Mapper
public interface BrowseRecordAndShopMapper {

    @Select("select s.id shopId, bd.userId ,bd.time, s.logo , s.shop_name , s.user_id ShopUserId from browse_record bd, shop s where bd.userId=#{param1} and bd.shopId=s.id order by bd.time desc")
    ArrayList<BrowseRecordAndShop> getBrowseRecoedAndShopByUserId(String userId);

    @Select("select s.id shopId, bd.userId ,bd.time, s.logo , s.shop_name , s.user_id ShopUserId ,u.user_name userName from browse_record bd, shop s ,user u where bd.shopId=#{param1} and bd.shopId=s.id and u.id=bd.userId order by bd.time desc")
    ArrayList<BrowseRecordAndShop> getBrowseRecoedAndShopByShopId(String shopId);
}
